<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in bannerlist" :key="index">
        <img :src="item.imgurl" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { getBannerList } from "../../api/home";
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
Vue.use(Swipe);
Vue.use(SwipeItem);
export default {
  data() {
    return {
      bannerlist: [],
    };
  },
  created() {
    getBannerList().then((data) => {
      console.log(data);
      this.bannerlist = data.data;
    });
  },
};
</script>

<style scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.my-swipe {
  height: 1.8rem;
}
.my-swipe img {
  height: 100%;
}
</style>